# -*- coding: utf-8 -*-
class ProjectlogController < ApplicationController
  # フィルタ定義
  before_filter :login_required # ログインチェック

  #
  #=== プロジェクトの更新履歴を表示する
  #
  #指定プロジェクトの最新7日間の更新履歴を表示する．
  #
  def block_list
    limit_date = (Date.today - 7).strftime('%Y-%m-%d')
    conditions_sql = "dat_projects.valid_flg = 1 AND dat_projectlogs.created_on >= '#{limit_date}'"
    conditions_sql << " AND dat_projectcomps.project_id = ?"
    
    conditions = [conditions_sql]
    conditions << ((params[:project_id].nil?) ? '0' : params[:project_id].to_s)
    
    opt = {
      :conditions => conditions,
      :include    => [{:dat_projectcomp=>:dat_project}],
      :order      => "dat_projectlogs.created_on desc"
    }
    @projectlogs = DatProjectlog.find(:all, opt)
  end

end
